<?php
declare (strict_types = 1);

namespace app\service\logic\common\scale;

use app\model\communal\ScaleMultiExpertModel;
use app\service\logic\BaseService;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\Model;

final class MultiExpertService extends BaseService
{
    protected string $modelClassName = 'ScaleMultiExpertModel';

    /**
     * @param $scaleMultiId
     * @param $expertId
     * @return ScaleMultiExpertModel|array|mixed|Model
     * @throws DataNotFoundException
     * @throws ModelNotFoundException
     */
    public function getExpertByExpertScale($scaleMultiId, $expertId)
    {
        $model = ScaleMultiExpertModel::with(['belongsExpert'])
            ->where('scale_multi_id', $scaleMultiId)
            ->where('expert_id', $expertId)
            ->findOrFail();
        unset($model['belongsExpert']);
        return $model;
    }
}
